﻿@inherits DemoWithResizableComponent

<div class="demo-description" id="ReadOnly">
    <h2><DemoNavLink Link="TagBox#ReadOnly" />TagBox - Read-Only Mode</h2>
    <p>
        In this demo, the <a class="helplink" target="_blank" href="https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxTagBox-2">TagBox</a> displays values but does not allow users to change them.
        Set the <a class="helplink" target="_blank" href="https://docs.devexpress.com/Blazor/DevExpress.Blazor.DxTagBox-2.ReadOnly">ReadOnly</a> property to <b>true</b> to activate read-only mode.
    </p>
</div>

<div class="card demo-card demo-card-shadow">
    <div class="card-header">
        <DemoToolbar @bind-SelectedSize="SizeMode" Title="Tags cannot be changed" />
    </div>
    <div class="card-body mw-480">
        <DxTagBox Data="@DataSource"
                  @bind-Values="@Options"
                  ReadOnly="true"
                  HideSelectedItems="false"
                  SizeMode="SizeMode" />
    </div>
</div>

<CodeSnippet_Editor_TagBox_ReadOnly/>

@code {
    String[] DataSource = null;
    IEnumerable<string> Options { get; set; }

    protected override void OnInitialized() {
        base.OnInitialized();
        DataSource = new string[] { "Apple", "Banana", "Lemon", "Orange", "Pear", "Pinapple", "Peach" };
        Options = new List<string>() { DataSource[1], DataSource[4] };
    }
}
